﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AutoCode.SqlServer
{
    /// <summary>
    /// Mysql查询数据库结构语句
    /// </summary>
    public class MsSqlCommand
    {
        /// <summary>
        /// 获取表的所有列名和类型
        /// </summary>
        /// <param name="tableName"></param>
        /// <returns></returns>
        public static string GetColumnNames(string tableName)
        {
            return string.Format("SELECT COLUMN_NAME,DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '{0}';", tableName);
        }

        /// <summary>
        /// 获取当前数据库的所有表相关的信息
        /// </summary>
        public static string GetTables = "select   sysobjects.name,sys.extended_properties.value   from   sysobjects left join sys.extended_properties on sysobjects.id=sys.extended_properties.major_id  where   type= 'U ' and sys.extended_properties.minor_id='0' order by name";

    }
}
